import { CarFence } from '../models';


export async function getDefaultCarFence(){
    const entity = await getDefaultCorporate();
    const point = {
      type: 'Point',
      coordinates: [104.072619, 30.675472],//成都文殊院
      crs: { type: 'name', properties: { name: 'EPSG:4326'} }
    }
    const fenceAttrs = {
        name: "蜀科公司默认范围限制", 
        note: "系统默认",
        center: point,
    }
    const rlt = await CarFence.findOrCreate({where: fenceAttrs, defaults: {
        createdAt: new Date(),
        updatedAt: new Date(),
        CorporateEntityId: entity.id,
    }});

    const [fence, created] = rlt;

     return fence.get({
        plant: true,
    });
}